
<?php
class Cauhoi extends Zend_Db_Table_Abstract{
    protected $_name;
    protected $_primary = 'cauhoi_id';

    function __construct() {
        $this->_name = DB_PREFIX . "cauhoi";
        parent::__construct(); 
    }

    public function getColumns() {
        $results = array('cauhoi_id', 'cauhoi_tieude', 'cauhoi_status');
        return $results;
    }

    public function getPrimaryKey() {
        $pk = $this->_primary;
        if (is_array($pk)) {
            if (count($pk) > 0)
                return $pk[1]; // array[1] contain column name of primary key
        }
        return $this->_primary;
    }
    /**
     * This is funciton to get all cauhoi
     *
     * @author quanvo
     */
    public function getAllCauhoi(){
    	$table_name = $this->_name;
        $primary_key = $this->_primary;
        //check primary is array
        if(is_array($primary_key)){
        	$primary_key = $primary_key[1];
        }

        // get parent node and current node
        $select = Zend_Db_Table_Abstract::select();
        $select->from(array('c' => $table_name))
        ;

        $data = $this->fetchAll($select);
        return $data;
    }
}
?>
